/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package inventorymanagement;

/**
 *
 * @author Administrator
 */


import java.awt.BorderLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.util.Vector;

import javax.swing.JComboBox;
import javax.swing.JFrame;


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class ComboBox extends JFrame implements ActionListener{
JComboBox combo;
JTextField txt;
JLabel label1,label2,label3,label4,label5,label6,label7 ;

 JFrame frame = new JFrame("Product List");
 
public static void main(String[] args) {
   
ComboBox b = new ComboBox();
}

public ComboBox(){
 JButton SUBMIT;

 
  label6 = new JLabel();
  label6.setText("Please Select At Least One Product:");
 
  label1 = new JLabel();
  label1.setText("The product no 0 :Talk And Text Phones");
  label2 = new JLabel();
  label2.setText("The product no 1 :Music Phones");
  label3 = new JLabel();
  label3.setText("The product no 2 :Camera Phones");
  label4 = new JLabel();
  label4.setText("The product no 3 :Advanced Camera Phones");
  label5 = new JLabel();
  label5.setText("The product no 4 :Web n E-mail Phones");
  label7 = new JLabel();
  label7.setText("");
  
  
  
String course[] = {"0","1"};

JPanel panel = new JPanel(new GridLayout(7,1));

combo = new JComboBox(course);
combo.setBackground(Color.gray);
combo.setForeground(Color.red);
txt = new JTextField(10);

SUBMIT=new JButton("SUBMIT");
  
 panel.add(label6);
 panel.add(label1);
 panel.add(label2);
// panel.add(label3);
// panel.add(label4);
// panel.add(label5);
 panel.add(combo);
 panel.add(txt);
 panel.add(label7);
 panel.add(SUBMIT); 

 frame.add(panel);

 SUBMIT.addActionListener(this);
 
 
combo.addItemListener(new ItemListener(){
public void itemStateChanged(ItemEvent ie){
String str = (String)combo.getSelectedItem();
//System.out.print("hii");
txt.setText(str);

}
});
  


frame.setSize(500,500);
frame.setVisible(true);

}
public void actionPerformed(ActionEvent ae)
  {
  //  System.out.println("hello");
    String value1=txt.getText(); 
    
    if(value1.equals("0")){
        
         Items a1=new Items();
         frame.dispose();


         a1.Items1();
    }
    
     if(value1.equals("1")){
        
         Items a1=new Items();
         frame.dispose();


         a1.Items2();
    }
    
      if(value1.equals("2")){
        
         Items a1=new Items();
         frame.dispose();


         a1.Items3();
    }
    
     if(value1.equals("3")){
        
         Items a1=new Items();
         frame.dispose();


         a1.Items4();
    }
    if(value1.equals("4")){
        
         Items a1=new Items();
         frame.dispose();


         a1.Items5();
    }
  }
   
} 